package ai.people.platform.archives.service.impl;

import ai.people.netmon.framework.domain.archives.entity.ArchivesCompanyInfo;
import ai.people.platform.archives.mapper.ArchivesCompanyInfoMapper;
import ai.people.platform.archives.service.ArchivesCompanyInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhenglin
 * @since 2022-03-30
 */
@Service
public class ArchivesCompanyInfoServiceImpl extends ServiceImpl<ArchivesCompanyInfoMapper, ArchivesCompanyInfo> implements ArchivesCompanyInfoService {

    /**
     * 通过档案基本信息ID查询公司信息
     *
     * @param baseInfoId 基础信息id
     * @return {@link ArchivesCompanyInfo}
     */
    @Override
    public ArchivesCompanyInfo selectByBaseInfoId(Long baseInfoId) {
        LambdaQueryWrapper<ArchivesCompanyInfo> companyWrapper = Wrappers.lambdaQuery();
        companyWrapper.eq(ArchivesCompanyInfo::getBaseInfoId, baseInfoId);
        return this.getOne(companyWrapper);
    }
}
